<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('封禁理由')" />

</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-task-edit" >
              <input name="userId" th:value="${userId}"  type="hidden" >
          
            <div class="form-group">
                <label class="col-sm-2 control-label">封禁理由：</label>
                <div class="col-sm-8">
                    <select name="vipFlag" id="vipFlag" class="form-control m-b" th:with="type=${@dict.getType('justification')}" >
                      <option value="0">请选择</option>
                       <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
                    </select>
                </div>
            </div>
               <div class="form-group">
                <label class="col-sm-2 control-label">封禁等级：</label>
                <div class="col-sm-8">
<!--                    <input name="remark" class="form-control" type="text" >-->
                    <select name="bannedLevel" id="bannedLevel" class="form-control m-b" th:with="type=${@dict.getPropertyByType(11)}" >
                        <option value="0">请选择</option>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
                    </select>
                </div>
            </div>
            
            
            
            <!-- <div class="form-group">
                <label class="col-sm-2 control-label" style="color: red;">有效时间（分钟）：</label>
                <div class="col-sm-4">
                    <input name="vipflagdates" th:value="10" class="form-control" type="text" >
                </div>
            </div> -->
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
        var prefix = ctx + "system/user";
      $("#form-task-edit").validate({
            focusCleanup: true
        });
        function submitHandler() {
        	var id = $('input[name="userId"]').val();
        	var vipFlag=$("#vipFlag").find("option:selected").text();
            var bannedLevel=$("#bannedLevel").find("option:selected").text();
        	var remark = $('input[name="remark"]').val();
        	console.log(vipFlag=="请选择")
        	if(vipFlag=="请选择"){
        		$.modal.msgWarning("请选择封禁理由~");
        		return ;
             }
        	// if(remark==""||remark==null){
        	// 	$.modal.msgWarning("请填写封禁时间~");
        	// 	return;
            //  }
        	
            if ($.validate.form()) {
            	 var url = prefix + "/add_cancel";
				var data = { "ids": id,"time": remark,"vipFlag":vipFlag,"bannedLevel":bannedLevel};
				$.operate.save(url,data); 
            } 
        }
    </script>
</body>
</html>